package com.ww.grtsmanager.service.impl;

import com.ww.grtsmanager.mapper.CountMapper;
import com.ww.grtsmanager.service.CountService;
import com.ww.grtsmanager.vo.CountResult;
import com.ww.grtsmanager.vo.TeacherCounts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CountServiceImpl implements CountService {
    @Autowired
    private CountMapper countMapper;

    @Override
    public List<CountResult> courseResult() {
        List<CountResult> list=countMapper.courseResult();
        return list;
    }

    @Override
    public List<TeacherCounts> teacherNum() {
        List<TeacherCounts>list = new ArrayList<TeacherCounts>();
        for (int i = 0; i <= 12; i++) {
            int j = countMapper.teacherNum(i);
            if (j!=0){
                TeacherCounts teacherCounts = new TeacherCounts();
                teacherCounts.settNum(j);
                teacherCounts.setMonth(i+"月");
                list.add(teacherCounts);
            }

        }
        return list;
    }
}
